package com.zw.pm.module.system.log;

import com.zw.pm.base.BaseController;
import com.zw.pm.common.JsonResult;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Description: 日志 控制层
 *
 * @Author: China.sgl
 * @Date: 2019/11/28 13:48
 */
@Controller
@RequestMapping("/sys/log")
public class LogController extends BaseController {

    @Autowired
    private LogService logService;

    /**
     * 日志页面
     *
     * @return url
     */
    @GetMapping
    @RequiresPermissions({"system:log"})
    public String logPage() {
        return "system/log/page";
    }

    /**
     * 日志列表
     *
     * @param logModel 条件
     * @return json
     */
    @PostMapping("/list")
    @ResponseBody
    @RequiresPermissions({"system:log"})
    public JsonResult list(LogModel logModel) {
        startPage();
        List<LogModel> list = logService.findAll(logModel);
        return jsonResult(list);
    }

}
